module Curriculum
  class Schedule < Curriculum::Base
    self.table_name = "schedules"
    belongs_to :coach


    def timetable
      if schedulable_type.eql?('未发布')
        ct = Curriculum::Timetable.find_by(id: schedulable_id)
        ct.to_timetable
      else
        ::Timetable.find_by(id: schedulable_id)
      end
    end
  end
end
